home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / Developer University / DU Projects / DataCopy / Sources / Part.cpp < prev    next >
Encoding:
Text File  |  1996-08-22  |  3.0 KB  |  115 lines  |  [TEXT/CWIE]

  1. //========================================================================================
  2. //    Release Version:    $ ODF 2 $
  3. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  4.  
  5. //================================================================================
  6. #include "DataCopy.hpp"
  7.  
  8. #ifndef PART_H
  9. #include "Part.h"
  10. #endif
  11.  
  12. #ifndef CONTENT_H
  13. #include "Content.h"
  14. #endif
  15.  
  16. #ifndef BINDING_K
  17. #include "Binding.k"
  18. #endif
  19.  
  20. #ifndef DEFINES_K
  21. #include "Defines.k"
  22. #endif
  23.  
  24. #ifndef FRAME_H
  25. #include "Frame.h"
  26. #endif
  27.  
  28. #ifndef SELECTION_H
  29. #include "Selection.h"        // CDataCopySelection
  30. #endif
  31.  
  32. // ----- Framework Layer -----
  33. #ifndef FWPRESEN_H
  34. #include "FWPresen.h"        // FW_CPresentation
  35. #endif
  36.  
  37. #ifndef FWABOUT_H
  38. #include "FWAbout.h"        //::FW_About()
  39. #endif
  40.  
  41. //==============================================================================
  42. #ifdef FW_BUILD_MAC
  43. #pragma segment DataCopy
  44. #endif
  45.  
  46. FW_DEFINE_AUTO(CDataCopyPart)
  47.  
  48. //==============================================================================
  49. CDataCopyPart::CDataCopyPart(ODPart* odPart)
  50.   :    FW_CPart(odPart, FW_gInstance, kPartInfoID),
  51.     fPresentation(NULL),
  52.     fPartContent(NULL)
  53. {
  54.     FW_END_CONSTRUCTOR
  55. }
  56.  
  57. //--------------------------------------------------------------------------------
  58. CDataCopyPart::~CDataCopyPart()
  59. {
  60.     FW_START_DESTRUCTOR
  61. }
  62.  
  63. //--------------------------------------------------------------------------------
  64. void 
  65. CDataCopyPart::Initialize(Environment* ev, ODStorageUnit* storageUnit, 
  66.                             FW_Boolean fromStorage)    // Override
  67. {
  68.     FW_CPart::Initialize(ev, storageUnit, fromStorage);
  69.     CDataCopySelection* selection = FW_NEW(CDataCopySelection, (ev, fPartContent));
  70.     const ODType kMainPresentation = "Apple:Presentation:DataCopy";
  71.     const FW_Boolean kDefaultPresentation = true;
  72.     fPresentation = RegisterPresentation(ev, kMainPresentation, 
  73.                                             kDefaultPresentation, selection);
  74. }
  75.  
  76. //--------------------------------------------------------------------------------
  77. FW_Handled 
  78. CDataCopyPart::DoAbout(Environment* ev)    // Override
  79. {
  80.     ::FW_About(ev, this, kAbout);
  81.     
  82.     return FW_kHandled;
  83. }
  84.  
  85. //--------------------------------------------------------------------------------
  86. FW_CFrame* 
  87. CDataCopyPart::NewFrame(Environment* ev, ODFrame* odFrame,
  88.                         FW_CPresentation* presentation, FW_Boolean fromStorage)    // Override
  89. {
  90.     FW_UNUSED(fromStorage);
  91.     return FW_NEW(CDataCopyFrame, (ev, odFrame, presentation, fPartContent));
  92. }
  93.  
  94. //------------------------------------------------------------------------------
  95. FW_CContent* 
  96. CDataCopyPart::NewPartContent(Environment* ev)
  97. {
  98.     fPartContent = FW_NEW(CDataCopyContent, (ev, this));
  99.     return fPartContent;
  100. }
  101.  
  102. //------------------------------------------------------------------------------
  103. void 
  104. CDataCopyPart::MyInvalidatePresentation(Environment* ev, FW_CRect& rect)
  105. {
  106.     fPresentation->Invalidate(ev, rect);
  107. }
  108.  
  109. //------------------------------------------------------------------------------
  110. void 
  111. CDataCopyPart::MyInvalidatePresentation(Environment* ev)
  112. {
  113.     fPresentation->Invalidate(ev);
  114. }
  115.